<!-- ------------------------------------------------------------------------- -->
<!-- ------------------------------------------------------------------------- -->
<!-- ---------------------- 流调管理--确诊病例管理 ---------------------------- -->
<!-- ------------------------------------------------------------------------- -->
<!-- ------------------------------编辑的tag---------------------------------- -->
<!-- -------------------------编辑的tag--感染来源分析----------------------------- -->

<template>
  <div class="box">
    <div class="table-box">
        <el-form
      ref="ruleFormRef"
      :model="ruleForm"
      :rules="rules"
      label-width="120px"
      class="demo-ruleForm"
      :size="formSize"
      status-icon
    >
      <el-form-item
        label="现场流行病学线索:"
        prop="count"
        style="margin-right: 100px; width: 500px"
      >
        <el-input v-model="ruleForm.count" style="height: 150px" />
      </el-form-item>

      <el-form-item
        label="初步结论:"
        prop="count"
        style="margin-right: 100px; width: 500px"
      >
        <el-input v-model="ruleForm.count" style="height: 150px" />
      </el-form-item>

      <el-form-item class="btn-box">
        <el-button>取消</el-button>
        <el-button type="primary" @click="onSubmit">确定</el-button>
      </el-form-item>
    </el-form>
    </div>
  
  </div>
</template>

<script lang="ts">
import { reactive, defineComponent, ref } from "vue";
import type { FormInstance, FormRules } from "element-plus";

export default defineComponent({
  name: "EditorialOnsetVisits",
  setup() {
    const formSize = ref("large");
    const ruleFormRef = ref<FormInstance>();
    const value1 = ref("");

    const ruleForm = reactive({
      name: "Hello",
      region: "",
      count: "",
      date1: "",
      date2: "",
      delivery: false,
      type: [],
      resource: "",
      desc: "",
    });

    const rules = reactive<FormRules>({
      name: [
        {
          required: true,
          message: "Please input Activity name",
          trigger: "blur",
        },
        { min: 3, max: 5, message: "Length should be 3 to 5", trigger: "blur" },
      ],
      region: [
        {
          required: true,
          message: "Please select Activity zone",
          trigger: "change",
        },
      ],
      count: [
        {
          required: false,
          message: "Please select Activity count",
          trigger: "change",
        },
      ],
      date1: [
        {
          type: "date",
          required: true,
          message: "Please pick a date",
          trigger: "change",
        },
      ],
      date2: [
        {
          type: "date",
          required: true,
          message: "Please pick a time",
          trigger: "change",
        },
      ],
      type: [
        {
          type: "array",
          required: true,
          message: "Please select at least one activity type",
          trigger: "change",
        },
      ],
      resource: [
        {
          required: true,
          message: "Please select activity resource",
          trigger: "change",
        },
      ],
      desc: [
        {
          required: true,
          message: "Please input activity form",
          trigger: "blur",
        },
      ],
    });

    const submitForm = async (formEl: FormInstance | undefined) => {
      if (!formEl) return;
      await formEl.validate((valid, fields) => {
        if (valid) {
          console.log("submit!");
        } else {
          console.log("error submit!", fields);
        }
      });
    };

    const resetForm = (formEl: FormInstance | undefined) => {
      if (!formEl) return;
      formEl.resetFields();
    };

    const options = Array.from({ length: 10000 }).map((_, idx) => ({
      value: `${idx + 1}`,
      label: `${idx + 1}`,
    }));

    const onSubmit = () => {};

    return {
      formSize,
      ruleFormRef,
      ruleForm,
      rules,
      submitForm,
      resetForm,
      options,
      value1,
      onSubmit,
    };
  },
});
</script>

<style scoped lang="less">
.box{
    width: 100%;
    background-color: #fff;
    display: flex;
    justify-content: center;
}
.table-box{
    width: 90%;
}
.el-form {
  padding-top: 40px;
  width: 100%;
  background-color: #fff;
  height: 100vh;
}
.btn-box{
    padding-top: 100px;
}
</style>
